<?php
//模板页的png显示缓存
class page_image_auto_cache extends auto_cache{
	public function load($param)
	{
		$key = $this->build_key(__CLASS__,$param);
		$image_str = S($key);
		if($image_str === false)
		{
			$img = $param['img'];
			$img_path = str_replace("./",get_domain().APP_ROOT."/",$img);
			$img_real_path = WEB_PATH.$img;
			$info = getimagesize($img_real_path);
			$info['mime'] = mime_content_type($img_real_path);
			if($info['mime']=='image/png')
			{
				$image_str = "<span style='display:inline-block; width:".intval($info['width'])."px; height:".intval($info['height'])."px; background:url(".$img_path.") no-repeat; _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=".$img_path.", sizingMethod=scale);_background-image:none;'></span>";
			}
			else
			{
				$image_str = "<img src='".$img_path."' width='".intval($info['width'])."' height='".intval($info['height'])."' />";
			}
			S("PAGE_IMAGE_".$img,$image_str);
		}	
		return $image_str;
	}
	public function rm($param)
	{
		$key = $this->build_key(__CLASS__,$param);
		S($key,null);
	}
	public function clear_all()
	{
		return true;
	}
}
?>